package com.starkuz.controllers;


import com.starkuz.dao.ifaces.leads.LeadDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

@Controller
public class GetterSubscribers {

    @Autowired
    private LeadDao leadDao;

    public void setLeadDao(LeadDao leadDao) {
        this.leadDao = leadDao;
    }

    // для перехвата подписчиков
    @RequestMapping(value = "/addsubscriber.html", method = RequestMethod.GET)
    public void editLaunchSoon(@RequestParam(value = "email", required = true) String email,
                                 @RequestParam(value = "site_id", required = true) Integer siteId,
                                 Map model) {
    leadDao.addLead(siteId, email);
    }
}
